import axio from 'axios'
import store from '@/store'
const requset = axio.create({
  baseURL: '/likede',
  timeout: 5000
})

requset.interceptors.request.use(
  (config) => {
    const token = store.state.user.token
    if (token) config.headers.Authorization = `${token}`
    return config
  },
  (err) => {
    return Promise.reject(err)
  }
)

requset.interceptors.response.use(
  (response) => {
    return response.data
  },
  (err) => {
    return Promise.reject(err)
  }
)

export default requset

// 引入axios
// create个axios的实例 ，配置基地址，请求时间
// 拦截器
// 默认抛出
